Repository navigation
fix: analyze string const by comparing with full name - #82
Conversation
The version <=1.2.6 has checked const string values. This is missing in the new dependency implementation and has been fixed by this commit. A test has also been added.
|
@BenMorris is there any chance to get this into a new release on nuget.org? We would like to use the performance optimized library because we do have a lot of architecture rules which might increase our execution time. |
|
This has been shipped as version 1.3.1: https://www.nuget.org/packages/NetArchTest.Rules/1.3.1 |
|
After this PR all const string literals assigned to fields are treated as a dependency, even if they contain some regular text. For HaveDependencyOnAny and HaveDependencyOnAll it does not matter because they only match to given dependencies by the user. But it affects OnlyHaveDependenciesOnAnyOrNone, OnlyHaveDependenciesOnAny, OnlyHaveDependenciesOnAll, HaveDependencyOtherThan, all const strings literals that are just regular text will be detected as false positive dependency by them... Since having dependency in strings is very rare, I would propose to make this PR optional, as an opt-in and not as a default behaviour. |
|
This makes sense, but the catch here is that making this optional will involve quite a lot of code changes scattered throughout the implementation... is there an elegant way of including a switch? |
Here the final PR (based on #79) which uses the search tree to check for the depenency in string const fields. I was not able to use the
_cachedAnswersFromSearchTreeas I don't exactly know how to impl. a GetNode() for a string, which might be a type, namespace, generic or at least nothing of that. In such a case a simple string comparison might be better, but I had no idea how to integrate it into you search tree. Hope the current version fits to your idea of the search tree pattern, otherwise please let me know how to improve that.